<template>
  <div class="user-page">
    <div class="headPart">
      <div class="My_title__39w3V">
        <img
          class="My_bg__2j-VX"
          src="http://liufusong.top:8080/img/profile/bg.png"
          alt="背景图"
        />
        <div class="My_info__eOYeg">
          <div class="My_myIcon__3cKIV">
            <img
              class="My_avatar__2Fbh7"
              src="http://liufusong.top:8080/img/profile/avatar.png"
              alt="icon"
            />
          </div>
          <div class="My_user__B6O1D">
            <div class="My_name__3U2NB">游客</div>
            <div class="My_edit__3wqlv">
              <a
                role="button"
                class="am-button am-button-primary am-button-small am-button-inline"
                aria-disabled="false"
                ><span @click="loginBtn">去登录</span></a
              >
            </div>
          </div>
        </div>
      </div>
    </div>
    <div class="middlePart">
      <van-grid clickable :column-num="3" :border="false">
        <van-grid-item icon="star-o" text="我的收藏" to="/" />
        <van-grid-item icon="wap-home-o" text="我的出租" to="/find" />
        <van-grid-item icon="clock-o" text="看房记录" />
        <van-grid-item icon="credit-pay" text="成为房主" />
        <van-grid-item icon="contact" text="个人资料" />
        <van-grid-item icon="service-o" text="联系我们" />
      </van-grid>
    </div>
    <div class="footPart">
      <img src="http://liufusong.top:8080/img/profile/join.png" alt="" />
    </div>
  </div>
</template>

<script>
import { getUserInfo } from '@/api/user'

export default {
  name: 'user-page',
  data () {
    return {
      active: 0,
      username: '',
      avatar: ''
    }
  },
  async created () {
    const data = await getUserInfo()
    this.username = data.username
    this.avatar = data.avatar
  },
  methods: {
    loginBtn () {
      this.$router.push('/login')
    }
  }
}
</script>

<style lang="less" scoped>
.My_title__39w3V {
  min-height: 300px;
  position: relative;
  .My_bg__2j-VX {
    width: 100%;
  }
  img {
    border-style: none;
  }
  .My_info__eOYeg {
    position: absolute;
    background: #fff;
    width: 85%;
    height: 55%;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    box-shadow: 0 0 10px 3px #ddd;
    margin: 50px auto 0;
    padding: 0 20px;
    text-align: center;
    font-size: 13px;
    .My_myIcon__3cKIV {
      position: relative;
      transform: translateY(-50%);
      border-radius: 50%;
      width: 70px;
      height: 70px;
      border: 5px solid #f5f5f5;
      display: inline-block;
      box-shadow: 0 2px 2px #bdbdbd;
      .My_avatar__2Fbh7 {
        width: 100%;
        border-radius: 50%;
      }
    }
  }
  .My_user__B6O1D {
    padding-top: 15px;
    .My_name__3U2NB {
      margin-top: -30px;
      margin-bottom: 10px;
    }
    .My_edit__3wqlv {
      color: #999;
      font-size: 12px;
      margin-top: 20px;
    }
    .My_edit__3wqlv .am-button-primary {
      background-color: #21b97a;
    }
    .am-button-small {
      font-size: 13px;
      height: 30px;
      line-height: 30px;
      padding: 0 15px;
    }
    .am-button-inline {
      display: inline-block;
      padding: 0 15px;
      border-radius: 5px;
      color: #fff;
    }
  }
}
van-grid {
  align-items: center;
}
.user-page {
  padding: 100px, 20px;
  position: relative;
  background-image: url(http://liufusong.top:8080/img/profile/bg.png);
  headPart {
    height: 500px;
    .userCard {
      position: absolute;
      background: #fff;
      width: 85%;
      height: 55%;
      bottom: 0;
      left: 50%;
      transform: translateX(-50%);
      box-shadow: 0 0 10px 3px #ddd;
      margin: 50px auto 0;
      padding: 0 20px;
      text-align: center;
      font-size: 13px;
      .pic {
        position: relative;
        transform: translateY(-50%);
        border-radius: 50%;
        width: px;
        height: 70px;
        border: 5px solid #f5f5f5;
        display: inline-block;
        box-shadow: 0 2px 2px #bdbdbd;
        img {
          width: 100%;
          border-radius: 50%;
        }
      }
    }
  }
  .footPart {
    text-align: center;
    margin-top: 10px;
    img {
      width: 90%;
    }
  }
}
</style>
